package org.gbis.openbus.webbean;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import javax.servlet.http.HttpServletRequest;

public class WebBeanSearchRoute extends WebBean {

	private String keyword;
	
	public String getKeyword() {
		return keyword;
	}

	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}

	@Override
	public String toString() {
		String format = "webBeanSearchRoute{ key: %s, keyword:%s }";

		return String.format(format, this.getKey(), this.getKeyword() );
	}

	@Override
	public Object[] getSearchParams() {
		Date date = new Date();
		String pattern = "yyyymmdd";
		SimpleDateFormat formatter = new SimpleDateFormat( pattern, new Locale("ko","KOREA") );
	 
		String s = formatter.format(date);
		s = "P_"+s;
		System.out.println("=======>>>>"+s);
		
		return new Object [] { this.getKeyword() };
	}

	@Override
	public String [] getLogParams() {
		String params [] = new String[ 10 ];
		int idx = 0;
		params[ idx ] = this.getKeyword();
		idx ++ ;
		return params;
	}

	@Override
	public String getApiName() {
		return "routesearch";
	}

	private WebBeanSearchRoute() {
	}

	public static WebBeanSearchRoute getNewWebBeanSearchRoute(HttpServletRequest request) {
		WebBeanSearchRoute bean = new WebBeanSearchRoute();

		bean.setKey( getString( request, "key"));
		
		bean.setKeyword(getString(request, "keyword"));

		return bean;
	}


}
